package cn.tth.test.controller;

import com.bb.api.order.feign.NewApiBaibuAppServiceFeignClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
//@EnableAsync
@Slf4j
public class HelloController {

    @Resource
    private NewApiBaibuAppServiceFeignClient newApiBaibuAppServiceFeignClient;

    @Resource
    private ConfigurableApplicationContext context;

    @RequestMapping(value = "helloController")
    public String hello(String a) throws InterruptedException {
//        System.out.println(helloController);
//        HelloController helloController = (HelloController) context.getBean("helloController");
//        System.out.println(helloController);
//        helloController.Hello1();
//        Hello1();
        newApiBaibuAppServiceFeignClient.countOrderUnreadMsg(1);
        return "hello word";
    }

    @Async
    public void Hello1() throws InterruptedException {
        Thread.sleep(10000);
        System.out.println("123123123");
    }
}
